export function isLogin(account, password) {
	return new Promise((resolve, reject) => {
		uni.request({
			url: 'login',
			data: {
				"userName": account,
				"password": password
			},
			method:'POST',
			header:{'content-type':'application/x-www-form-urlencoded'},
			success(res) {
				resolve(res.data);
			},
			fail: (err) => {
				reject(err);
			}
		});
	})
};

export function isToken(){
	return new Promise((resolve, reject)=>{
		uni.request({
			url:'uni-app/sys-user/isToken',
			success(res) {
				resolve(res.data)
			},
			fail: (err) => {
				reject(err)
			}
		})
	})
};

export function registerLogin(baseFormData,account){
	return new Promise((resolve,reject)=>{
		uni.request({
			url: 'uni-app/sys-user/insert',
			data: {
				"usrName": baseFormData.name,
				"usrPassword": baseFormData.password,
				"usrEmail": baseFormData.email, // 添加邮箱数据
				"usrAccount": account
			},
			success(res) {
				resolve(res.data);
			},
			fail(error) {
				console.error('注册失败:', error);
				uni.showToast({
					title: '注册失败',
					icon: 'none'
				});
			}
		});
	})
}
export function sendMessage(){
	return new Promise((resolve,reject)=>{
		uni.request({
			url:'uni-app/sys-user/sendMessage',
			success(res) {
				resolve(res.data);
			},
			fail(err) {
				reject(err);
			}
		})
	})
}